package com.sxt.aspect;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class MyAspect {
    public static final String POINTCAT1 ="execution(* com.sxt.domain.Man.eat(..))";

    @Before(POINTCAT1)
    public void before(){
        System.out.println("饭前喝汤");
    }

    @AfterReturning(POINTCAT1)
    public void afterReturning(){
        System.out.println("饭后喝酒");
    }

    @Around(POINTCAT1)
    public void around(ProceedingJoinPoint pjp) throws Throwable {
        System.out.println("饭前一支烟");
        pjp.proceed();
        System.out.println("饭后一瓶酒");
    }
}
